package com.qijian.maindata.domain.query;

import com.baomidou.mybatisplus.annotation.TableName;
import com.qijian.common.utils.mybatis.WhereType;
import com.qijian.common.utils.mybatis.WhereTypeEnum;
import lombok.Data;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.List;
import java.util.Set;


/**
 * 外协明细对象 查询条件类
 *
 * @author qijian
 * @date 2021-10-15
 */

@Data
@ToString
@TableName("main_out_details")
public class OutDetailsNewQuery {

    @WhereType(filed = "detail_id")
    private Long detailId;
    @WhereType(filed = "out_id")
    private Long outId;
    @WhereType(filed = "out_id", type = WhereTypeEnum.IN)
    private List<Long> outIds;
    //    @WhereType(filed = "work_id")
//    private Long workId;
    @WhereType(filed = "work_id", type = WhereTypeEnum.NOTIN)
    private List<Long> workIds;
    @WhereType(filed = "work_cost")
    private BigDecimal workCost;
    @WhereType(filed = "total_weight")
    private BigDecimal totalWeight;
    @WhereType(filed = "detail_id", type = WhereTypeEnum.IN)
    private Set<Long> ids;
    @WhereType(filed = "is_del")
    private Boolean isDel;
    @WhereType(filed = "is_out_bound")
    private Boolean isOutBound;
    @WhereType(filed = "process_name", tableName = "main_process_order", type = WhereTypeEnum.LIKE)
    private String processName;
    @WhereType(filed = "item_name", tableName = "main_process_order", type = WhereTypeEnum.LIKE)
    private String itemName;
    @WhereType(filed = "project_no", tableName = "main_project", type = WhereTypeEnum.LIKE)
    private String projectNo;
    @WhereType(filed = "machine_no", tableName = "main_project")
    private String machineNo;
    @WhereType(filed = "status", type = WhereTypeEnum.IN)
    private List<Integer> status;
    @WhereType(filed = "status", tableName = "main_out", type = WhereTypeEnum.IN)
    private List<Integer> outStatus;
    @WhereType(filed = "supplier_name", tableName = "main_out", type = WhereTypeEnum.LIKE)
    private String supplierName;
    @WhereType(filed = "out_code", tableName = "main_out", type = WhereTypeEnum.LIKE)
    private String outCode;
    @WhereType(filed = "detail_id", type = WhereTypeEnum.IN)
    private List<Long> detailIds;
    @WhereType(ignore = true)
    private long checkStatus;

    @WhereType(filed = "create_by")
    private String createBy;
    @WhereType(filed = "source_type")
    private Integer sourceType;
    @WhereType(ignore = true)
    private long type;
    @WhereType(ignore = true)
    private String code;
    @WhereType(ignore = true)
    private Boolean isTree;
    @WhereType(ignore = true)
    private String processTypeName;
    @WhereType(ignore = true)
    private Boolean isFlag = true;

    @WhereType(func = "((main_out_details.is_del = true and main_out.is_del = 0 )  or main_out.is_del = true )")
    private Boolean isDetailDel;

    @WhereType(func = " main_out_details.work_number > IFNUll(main_out_details.out_quantity,0) ")
    private Boolean stockOutUndoFlag;

    @WhereType(func = " IFNUll(main_out_details.out_quantity,0) > IFNUll(main_out_details.Inspection_quantity,0) ")
    private Boolean inspectionUndoFlag;

    @WhereType(func = " IFNUll(main_out_details.Inspection_quantity,0) > IFNUll(main_out_details.check_quantity,0) and main_out_detail_inspection.uncheck_quantity >0")
    private Boolean checkUnDoFlag;


    @WhereType(func = " IFNUll(main_out_details.qualified_quantity,0) > IFNUll(main_out_details.in_quantity,0) ")
    private Boolean inUnDoFlag;

    @WhereType(func = " IFNUll(main_out_details.in_quantity,0)  > IFNUll(invoice_quantity,0) ")
    private Boolean invoiceUndoFlag;

    @WhereType(filed = "uncheck_qty",tableName = "main_out_detail_inspection", type = WhereTypeEnum.GT)
    private BigDecimal greatThanUncheckQty;

    @WhereType(filed = "supplier_id", tableName = "main_out")
    private Long supplierId;

    @WhereType(filed = "out_code", tableName = "main_out")
    private String outCodeEq;

    @WhereType(filed = "check_type")
    private String checkTypeEqual;
}
